package org.liulinlin.sejw.db;

import java.sql.*;

public class SNStatus {
	private int id;
	private String snId;
	private String name;
	private FormEmployee formEmployee;
	private Date opTime;
	private String opTimeString;
	private String comments;
	
	public SNStatus() {
		
	}
	public SNStatus(int id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("SNStatus不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from SNStatus where SNS_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			snId = rs.getString("SN_ID");
			name = rs.getString("SNS_Name");
			formEmployee = new FormEmployee(rs.getString("FE_ID"));
			opTime = rs.getDate("SNS_OPTime");
			opTimeString = opTime.toString();
			comments = rs.getString("SNS_Comments");
			
			stmt.close();
			rs.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(int id) {
		this.id = id;
	}
	public void setSnId(String snId) {
		this.snId = snId;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setFormEmployee(FormEmployee formEmployee) {
		this.formEmployee = formEmployee;
	}
	public void setOPTime(Date opTime) {
		this.opTime = opTime;
	}
	public void setOPTimeString(String opTimeString) {
		this.opTimeString = opTimeString;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	
	public int getId() {
		return id;
	}
	public String getSnId() {
		return snId;
	}
	public String getName() {
		return name;
	}
	public FormEmployee getFormEmployee() {
		return formEmployee;
	}
	public Date getOPTime() {
		return opTime;
	}
	public String getOPTimeString() {
		return opTimeString;
	}
	public String getComments() {
		return comments;
	}
}
